<script setup lang="ts">
import {ref, defineProps, defineEmits} from "vue";
const toy = ref("拉布布")
defineProps({
  car1: {
    type: String,
    default: ''
  }
})
const emits = defineEmits(['getToy'])
const toToy = () => {
  emits("getToy", toy)
}
</script>

<template>
  <div class="child">
    <h3>子组件</h3>
    <h4>我的玩具：{{ toy }}</h4>
    <h4>父给我的车：{{ car1 }}</h4>
    <button @click="toToy()">玩具给父亲</button>
  </div>
</template>

<style scoped>

</style>